import path from 'path'

const MODE_TEST = process.env.MODE_TEST === 'true'

const TEST_ROOT = 'tests'

const PROJECT_ROOT = MODE_TEST ? path.resolve(process.cwd(), TEST_ROOT) : process.cwd()

const PROJECT = {
  ROOT: PROJECT_ROOT,
  __PROJECT__: path.resolve(PROJECT_ROOT + '/__project__.json'),
  SRC: {
    ROOT: path.resolve(PROJECT_ROOT + '/src'),
    ENTRY: path.resolve(PROJECT_ROOT + '/src/index.js'),
    ENV: path.resolve(PROJECT_ROOT + '/src/ENV.json'),
  },
  LOG: {
    ROOT: path.resolve(PROJECT_ROOT + '/log'),
    ACCESS: path.resolve(PROJECT_ROOT + '/log/access.log'),
    ERROR: path.resolve(PROJECT_ROOT + '/log/error.log')
  },
  BUILD: {
    ROOT: path.resolve(PROJECT_ROOT + '/build'),
    __ENV__: path.resolve(PROJECT_ROOT + '/build/__ENV__.json'),
  },
  BUILD_CLIENT: {
    ROOT: path.resolve(PROJECT_ROOT + '/buildclient'),
    DIST: path.resolve(PROJECT_ROOT + '/buildclient/dist'),
    ASSETS: path.resolve(PROJECT_ROOT + '/buildclient/assets'),
    MANIFEST_LOADABLE: path.resolve(PROJECT_ROOT + '/buildclient/loadable-stats.json'),
    MANIFEST_FILESMAP: path.resolve(PROJECT_ROOT + '/buildclient/filesmap-stats.json'),
    HTML: path.resolve(PROJECT_ROOT + '/buildclient/index.html'),
  },
}

export default PROJECT
